﻿/*
* Activity Tracking Log v0.1.1 - http://activitytrackinglog.codeplex.com
* Activity Tracking Log for ASP.Net & ASP.Net MVC
* Copyright (c) 2011 Vadim Burac
* Licensed under the Microsoft Public License (Ms-PL)
* http://activitytrackinglog.codeplex.com/license
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace ActivityTrackingLog.Configuration.ConfigSections
{
    internal class LogConfigSection : BaseConfigSection
    {
        #region config accessors

        [ConfigurationProperty("applicationKey", IsRequired = true)]
        public string ApplicationKey
        {
            get
            {
                return GetConfigValue("applicationKey", string.Empty);
            }
        }
        
        [ConfigurationProperty("logSessionEvents", IsRequired = false)]
        public bool LogSessionEvents
        {
            get
            {
                return GetConfigValue("logSessionEvents", false);
            }
        }

        [ConfigurationProperty("logRequestEvents", IsRequired = false)]
        public bool LogRequestEvents
        {
            get
            {
                return GetConfigValue("logRequestEvents", false);
            }
        }

        [ConfigurationProperty("logAuthEvents", IsRequired = false)]
        public bool LogAuthEvents
        {
            get
            {
                return GetConfigValue("logAuthEvents", false);
            }
        }

        [ConfigurationProperty("logSystemEvents", IsRequired = false)]
        public bool LogSystemEvents
        {
            get
            {
                return GetConfigValue("logSystemEvents", false);
            }
        }

        [ConfigurationProperty("logUserAgent", IsRequired = false)]
        public bool LogUserAgent
        {
            get
            {
                return GetConfigValue("logUserAgent", false);
            }
        }

        #endregion

        #region helpers

        public override string ToString()
        {
            return string.Format("{0}, {1}",
                base.ToString(),
                string.Format("ApplicationKey: {0}, LogSystemEvents: {1}, LogSessionEvents: {2}, LogRequestEvents: {3}, LogAuthEvents: {4}, LogUserAgent: {5}", 
                    ApplicationKey, 
                    LogSystemEvents,
                    LogSessionEvents,
                    LogRequestEvents,
                    LogAuthEvents,
                    LogUserAgent));
        }

        #endregion
    }
}
